<!--
 * @Author: your name
 * @Date: 2022-02-24 09:55:14
 * @LastEditTime: 2022-02-24 11:31:45
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \briup-study\day04\绝对定位.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绝对定位-父元素</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .parent1{
            width: 600px;
            height: 600px;
            background-color: rgb(126, 3, 3);
            padding: 100px;
            box-sizing: border-box; 
           /*  border: 1px solid black; */
           /*  position: relative; */
        }
        .parent2{
            width: 400px;
            height: 400px;
            background-color: blue;
           /*  margin: 100px;
            border: 1px solid black; */
            padding: 100px;
            box-sizing: border-box;
           /*  position: relative;  *//* 相对定位对文档影响最小 */
        }
        .child{
            width: 200px;
            height: 200px;
            background-color: blueviolet;
            /*  position: absolute;
             top: 10px;
             left: 10px; */
        }
        .static{
            width: 100px;
            height: 100px;
            background-color: blueviolet;
        }
        /* 居中方案
        1.padding: 100px;
          box-sizing: border-box; 因为为内容盒子 w3c盒子的宽为width+padding会撑大盒子，所以这儿换位ie盒子
          2.、margin: 100px;
            border: 1px solid black;
           */
    </style>
</head>

<body>
    <div class="parent1">
        <div class="parent2">
            <div class="child"></div>
        </div>
    </div>
    <div class="static">其他的元素</div>
</body>
</html>